#include <reg52.h>


void delay_ms(unsigned int ms) 
{
    unsigned int i, j;
    for (i = ms; i > 0; i--) 
	{
        for (j = 110; j > 0; j--);
    }
}

int main() 
{
    unsigned char led;

    while (1) 
	{
        led = 0xFE;
        while (led != 0xFF)
		 { 
            P1 = led;         
            delay_ms(200);          
            led = (led << 1) | 0x01; 
        }

        led = 0x7F;
        while (led != 0xFF)
		 { 
            P1 = led;       
            delay_ms(200);          
            led = (led >> 1) | 0x80;
        }
    }
	return 0;
}

